﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.Plugins;
using System.Windows.Controls;
using System.Reflection;

namespace RemoteTranslation.ConfigurationController.Plugins
{
    [UtilityPluginMetadata("RemoteTranslationControllerPlugin")]
    public class RemoteTranslationControllerPlugin : IUtilityPlugin
    {
        #region Fields

        private RemoteTranslationControllerUserControl _optionsUI = new RemoteTranslationControllerUserControl();
        private string _status;

        #endregion

        #region IUtilityPlugin Events

        public event EventHandler StatusUpdated;
        public event EventHandler<ShowMessageEventArgs> ShowMessage;

        #endregion

        #region IUtilityPlugin Properties

        public UserControl OptionsUserControl
        {
            get { return _optionsUI; }
        }

        public string Name
        {
            get { return "Remote Translation Controller"; }
        }

        public Uri PluginIconUri
        {
            get
            {
                string path = "pack://application:,,,/RemoteTranslation.ConfigurationController.Plugins;component/Resources/RTContoller.png";
                return new Uri(path);
            }
        }

        public string Description
        {
            get { return "Remote Translation Controller"; }
        }

        public string Author
        {
            get { return "Dmitry Khaymov"; }
        }

        public Version Version
        {
            get { return Assembly.GetExecutingAssembly().GetName().Version; }
        }

        public Uri AuthorUri
        {
            get { return new Uri("www.kab.co.il"); }
        }

        public Uri UpdateUri
        {
            get { return new Uri("www.kab.co.il\\plugins"); }
        }

        public string Status
        {
            get { return _status; }
            set
            {
                if (value != _status)
                {
                    _status = value;

                    if (StatusUpdated != null)
                        StatusUpdated(this, null);
                }
            }
        }

        #endregion

        #region IUtilityPlugin Methods

        public void Initialize()
        {
            _optionsUI.DataContext = this;
        }

        public void Start()
        {
            Status = "Started";
        }

        public void Stop()
        {
        }

        #endregion
    }
}
